<template>
	<view>
		<!-- 合同付款报销审核 -->
		<view class="head_tb">
			<u-tabs :activeStyle="{
						 fontSize:'32rpx',
						 color: '#007aff'
			         }" :inactiveStyle="{
						 fontSize:'30rpx'
			         }" :scrollable='false' :lineWidth='30' itemStyle='height:90rpx;width:33%' :list="list1"
				@click="checkbtn"></u-tabs>
		</view>
		
		<!-- 基本信息 -->
		<view class="msp">
			<CellChild :addlist = 'addlist' title='基本信息' :rows='rows' :fileNo = 'fileNo' id='add_one'>
			</Cellchild>
		</view>
		
		<!-- 收款方信息 -->
		<view v-for="(item,index) in rows.payeeList">
			<CellChild :addlist = 'addlist1' :rows='item' title="收款方信息" />
		</view>
		<!-- 合同信息 -->
		<CellChild :addlist = 'addlist2' :rows='contractInfo' title="合同信息" id='add_two' />
		<!-- 验收信息 -->
		<CellChild :addlist = 'addlist3' :rows='contractAcceptanceList' title="验收信息" />
		
		<!-- 支付计划 -->
		<view class="formcard" id="add_three">
			<view class="bodtitle">
				<p><b>支付计划</b></p>
			</view>
			<!-- 左侧小点 -->
			<view v-for="(r,index) in contractPayPlan">
				<Expandlist :cellshows='cellshow' :arrcell = 'r' :celllist='celllist' :title='r.planDate'>
					<template #lefttitle>
						<span style='color: rgb(0, 199, 255);font-weight: 900;'>·</span>
					</template>
				</Expandlist>
			</view>
			
			
			
		</view>
		
		
		<!-- 本次付款信息 -->
		<view class="formcard" id="add_four">
			<view class="bodtitle">
				<p><b>本次付款信息</b></p>
			</view>
			<view v-for="(s,index) in budgetList">
				<Expandlist :cellshows='cellshow' :arrcell = 's' :celllist='celllist1' :title='s.contractPayNo'>
						<template #text>
							<p class='solts'><label class="solts_label">￥</label><span class="solts_span" v-money>{{s.reimAmt}}</span></p>
						</template>
				</Expandlist>
			</view>
			
			
		</view>
		
		
		<!-- 合同付款记录 -->
		<view class="formcard">
			<view class="bodtitle">
				<p><b>合同付款记录</b></p>
			</view>
			<view v-for="(a,index) in contractPayRecordVoList">
				<Expandlist :cellshows='cellshow' :arrcell = 'a' :celllist='celllist2' :title='a.billDate'>
						<template #text>
							<p class='solts'><label class="solts_label">￥</label><span class="solts_span" v-money>{{a.payAmt}}</span></p>
						</template>
				</Expandlist>
			</view>
			
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list1: [{
						name: '基本信息',
					},
					{
						name: '合同信息'
					},
					{
						name: '支付计划'
					},
					{
						name: '付款信息',
					}
				],
				cellshow:false,
				//基本信息
				addlist: [{
						tit: '公司名称',
						val: 'companyNm'
					},
					{
						tit: '事由',
						val: 'reasons'
					},
					{
						tit: '单据编号',
						val: 'contractPayNo'
					},
					{
						tit: '单据日期',
						val: 'billDate'
					},
					{
						tit: '记账日期',
						val: 'tallyDate'
					},
					{
						tit: '记账状态',
						val: 'bookStatus'
					},
					{
						tit: '科室',
						val: 'subdeptNm'
					},
					{
						tit: '申请人',
						val: 'userDesc'
					},
					{
						tit: '纸张单据张数',
						val: 'attaNum'
					},
					{
						tit: '是否三单匹配',
						val: 'detailType'
					},
					{
						tit: '报销后应付款',
						val: 'reimbursePayable'
					},
					{
						tit: '报销后应收款',
						val: 'reimburseReceivables'
					},
					
				],
				//收款方信息
				addlist1: [{ 
						tit: '收款方',
						val: 'payee'
					},
					{
						tit: '收款方银行',
						val: 'payeeBank'
					},
					{
						tit: '收款方银行账号',
						val: 'bankcardNo'
					}
				],
				//合同信息
				addlist2:[
					{
						tit: '合同编号',
						val: 'contractNo'
					},
					{
						tit: '合同类型',
						val: 'contractType'
					},
					{
						tit: '合同名称',
						val: 'contractNm'
					},
					{
						tit: '合同币种',
						val: 'coinKind'
					},
					{
						tit: '合同总价',
						val: 'contractPri',
						type:'number'
					},
					{
						tit: '累计已收发票金额',
						val: 'gaAmt',
						type:'number'
					},
					{
						tit: '累计已收发票比例(%)',
						val: 'gaPercent',
						type:'bfb'
					},
					{
						tit: '累计付款金额',
						val: 'payAmt',
						type:'number'
					},
					{
						tit: '累计付款金额比例(%)',
						val: 'payPercent',
						type:'bfb'
					},
					{
						tit: '本次付款金额',
						val: 'thispayAmt',
						type:'number'
					},
					{
						tit: '本次付款金额比例(%)',
						val: 'thispayPercent',
						type:'bfb'
					},
					{
						tit: '本次实际付款金额',
						val: 'thispayActualAmt',
						type:'number'
					},
					{
						tit: '本次付款类型',
						val: 'thispayType'
					},
					{
						tit: '已付款金额',
						val: 'payedAmt',
						type:'number'
					},
					{
						tit: '已付款金额比例(%)',
						val: 'payedPer',
						type:'bfb'
					},
					{
						tit: '结余未付款金额',
						val: 'nonpayAmt',
						type:'number'
					},
					{
						tit: '结余未付款金额比例(%)',
						val: 'nonpayPercent',
						type:'bfb'
					}
				],
				//验收信息
				addlist3:[
					{
						tit: '编号',
						val: 'contractNo'
					},
					{
						tit: '申请人',
						val: 'applyNo'
					},
					{
						tit: '验收阶段',
						val: 'acceptanceStage'
					},
					{
						tit: '申请部门',
						val: 'applyDeptNo'
					},
					{
						tit: '申请日期',
						val: 'applyDate'
					},
					{
						tit: '验收担当',
						val: 'acceptanceEmpNo'
					},
					{
						tit: '验收科室',
						val: 'acceptanceSubdeptNo'
					}
				],
				celllist:[
					{tit:'合同编号',val:'contractNo'},
					{tit:'合同名称',val:'contractNm'},
					{tit:'款项性质',val:'moneyTypeShow'},
					{tit:'款项比例',val:'moneyPercent',type:'bfb'},
					{tit:'款项金额',val:'moneyAmount',type:'number'},
					{tit:'税率',val:'taxRate',type:'bfb'},
					{tit:'币种',val:'currency'},
					{tit:'币种名称',val:'currencyType'},
					{tit:'发票类型',val:'paymentNature'},
					{tit:'发票类型名称',val:'paymentNatureShow'},
					{tit:'计划完成日期',val:'planDate'},
				],
				//本次付款信息
				celllist1:[
					// {tit:'预算号',val:''},
					{tit:'申请单号',val:'applNo'},
					{tit:'科室',val:'subdeptId'},
					{tit:'发票号',val:'invoiceNo'},
					{tit:'会计科目',val:'account'},
					{tit:'会计科目名称',val:'accountNm'},
					{tit:'不含税金额',val:'notaxAmt',type:'number'},
					{tit:'税率',val:'taxRate',type:'bfb'},
					{tit:'税额',val:'taxPer',type:'number'},
					{tit:'含税金额',val:'inTaxAmt',type:'number'},
					{tit:'报销金额',val:'reimAmt',type:'number'},
					{tit:'成本中心',val:'costCenter'},
					{tit:'预提单号',val:'accrualNo'},
					{tit:'预提金额',val:'accruedAmount'},
				],
				//合同付款记录
				celllist2:[
					{tit:'单据编号',val:'contractPayNo'},
					{tit:'单据日期',val:'tallyDate'},
					{tit:'申请人',val:'writer'},
					{tit:'付款金额',val:'payAmt',type:'number'},
					{tit:'收据金额',val:'receiptAmt',type:'number'},
					{tit:'发票金额',val:'invoiceAmt',type:'number'},
					{tit:'记账日期',val:'tallyDate'},
					{tit:'凭证号',val:'voucherNo'}
				],
				rows:[],
				arrlist:[],
				contractPayPlan:[], //支付计划
				contractInfo:[], //合同信息
				budgetList:[] ,//本次付款信息
				contractPayRecordVoList:[] ,//合同付款记录
				contractAcceptanceList:[] ,//验收信息
				fileNo:[]
			}
		},
		onLoad() {
			 //获取流程页面的流程上下文[实用的流程信息从这里获取]
			  let billNo= window.parent.myvm.wfContext.BusinessKey;
			  this.fileNo = window.parent.myvm.wfContext.BusinessKey;
			  this.getlist(billNo)
		},
		created() {
		},
		mounted() {
			var that = this;
			window.myvm = that;
			window.$urlFormVue = that;
		},
		methods: {
			getlist(contractPayNo){
				let _this = this
				const params = {
					contractPayNo
				}
				_this.$lyRequest.get('/gateway/reim/mp/dbsap/reim/contractPay/getDetail.do',
					params
				).then((result)=>{
					console.log(result)
					if(result.success){
						this.concatList(result.data.rows)
					}else{
						console.log('网络出错')
					}
				})
				
			},
			concatList(rows){
				this.rows = rows
				this.contractPayPlan = rows.contractPayPlan
				this.contractInfo = rows.contractInfo
				this.budgetList = rows.budgetList
				this.contractPayRecordVoList = rows.contractPayRecordVoList
				this.contractAcceptanceList = rows.contractAcceptanceList
				if(this.rows.bookStatus == 0){
					this.rows.bookStatus = '未记账'
				}else if(this.rows.bookStatus == 1){
					this.rows.bookStatus = '已记账'
				}
				if(this.rows.detailType == 1){
					this.rows.detailType = '否'
				}else if(this.rows.detailType == 2){
					this.rows.detailType = '是'
				}
				
				
				if(this.contractInfo.contractType == 1){
					this.contractInfo.contractType = '闭口合同'
				}else if(this.contractInfo.contractType == 2){
					this.contractInfo.contractType = '开口合同签订单合同'
				}else if(this.contractInfo.contractType == 3){
					this.contractInfo.contractType = '开口合同不签订单合同'
				}
			},
			//审批和驳回-工作流点击"提交"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			rejectWorkflow(btnDef) {
				return "";
			},
			//作废-工作流点击"作废"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//content为作废意见
			invalidWorkflow(content) {
				return "";
			},
			//转办-工作流点击"确认转办"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//opinion:转办意见
			referredWorkflow(opinion) {
				return "";
			},
			//校验-工作流点击"提交"时触校验函数，返回:true校验通过，false校验不通过；
			//也可以返回具体的错误信息：空字符串，校验通过，返回具体错误信息校验不通过，同时弹出具体的错误信息。
			validateWorkflowForm(btnDef,callback) {
				callback("");
			},
			//提交单据
			sendWorkflow(btnDef, callback) {
				callback("");
			},
			checkbtn(item) { //切换tabs
				if (item.index === 0) {
					this.commonApi.goAnchor('add_one')
				} else if (item.index === 1) {
					this.commonApi.goAnchor('add_two')
				} else if (item.index === 2) {
					this.commonApi.goAnchor('add_three')
				} else if (item.index === 3) {
					this.commonApi.goAnchor('add_four')
				}
			},
			
		}
	}
</script>

<style scoped lang="scss">
	view{
		font-family: pf
	}
	.bottom_setup {
		width: 100%;
		height: 160rpx;
		background-color: white;
		margin-top: 20rpx;
		padding: 35rpx 0;
		box-sizing: border-box;
		box-shadow: 5px -10rpx 5px 0px rgba(225, 225, 225, .4), ;
	
		.bottom_white1 {
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
			height: 100rpx;
	
			.custom-styles {
				padding: 20rpx 30rpx;
				width: 300rpx;
				height: 100rpx;
			}
	
			.custom-style {
				padding: 20rpx 30rpx;
				width: 300rpx;
				height: 100rpx;
				background-color: #007aff;
			}
		}
	}

	.bodcolor{
		span{
			color:#ff6400;
			font-size: 32rpx;
			padding-right: 20rpx;
			font-weight: bold;
			font-size: 36rpx;
		}
		label{
			font-weight: bold;
			color: #ff6400;
		}
	}
</style>
